package my.action.article;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;

import javax.servlet.http.*;

import my.controller.*;
import my.db.DAO.ArticleDAO;
import my.db.DAO.ArticleTypeDAO;
import my.db.DTO.ArticleDTO;
import my.db.DTO.ArticleTypeDTO;
public class ArticleEditAction implements  Action{
	 public ActionForward execute(HttpServletRequest request,HttpServletResponse response) throws Exception{			
		 	ActionForward forward=new ActionForward();	
		 	ArticleDTO dtoArt=new ArticleDTO();
		 	ArticleDAO daoArt=new ArticleDAO();
		 	ArticleTypeDAO atdao=new ArticleTypeDAO();
		 	ArrayList<ArticleTypeDTO> lst_atadto=new ArrayList<>();
		 	lst_atadto=atdao.getListArticleType();		 	
		 	int artNo=Integer.parseInt(request.getParameter("id"));
		 	dtoArt=daoArt.ReadArticle(artNo);
		 	request.setAttribute("ArticleTypeEdit", lst_atadto);
		 	request.setAttribute("readArticle",dtoArt);
		 	forward.setRedirect(false);
		 	forward.setPath("./edit_article_info.jsp");		 
	  		return forward;
		}  	
}